import reshandler from 'services/response-handler'

/* 查询频道分类 */
function getListArticleCategoryResponse(response) {
  return Object.assign({}, response, {
    articleCategorys: response.articleCategorys || []
  })
}
// 查询频道分类
export function ListArticleCategory(params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "ListArticleCategory",
  })

  fail = fail ? fail : (err, code) => {
    this.prototype.$.toast(err)
  }

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, getListArticleCategoryResponse), reshandler.error(fail))
}


/* 查询文章列表 */
function getListCarForumResponse(response) {
  return Object.assign({}, response, {
    carForums: response.carForums || []
  })
}
// 查询文章列表
export function ListCarForum(params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "ListCarForum",
  })

  fail = fail ? fail : (err, code) => {
    this.prototype.$.toast(err)
  }

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, getListCarForumResponse), reshandler.error(fail))
}

